home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
asm
/
pc370_3.exe
/
lha
/
SSP.ALC
< prev
next >
Wrap
Text File
|
1987-08-20
|
4KB
|
197 lines
TITLE 'SSP - PC/370 SCIENTIFIC SUBROUTINE PACKAGE'
*
* PGMID. SSP.ALC
* AUTHOR. DON HIGGINS.
* DATE. 07/22/87
* REMARKS.
*
* THIS MODULE CONTAINS SCIENTIFIC SUBROUTINES SIMILIAR
* TO FORTRAN LIBRARY FUNCTIONS. THESE ROUTINES REQUIRE
* PC/370 FLOATING POINT SUPPORT VIA 80X87 AND TAKE FULL
* ADVANTAGE OF 80X87 EXTENDED HARDWARE FUNCTIONS SUCH AS
* SQUARE ROOT, TANGENT, LOG, AND EXPONENT VIA SVC 35
* MICROCODE INSTRUCTION. SEE SSP.DOC FOR MORE INFORMATION.
*
* ARGUMENT IN F0 AND RESULT IN F0 UNLESS OTHERWISE NOTED.
* R15 SET TO 0 FOR NORMAL EXIT ELSE NOT ZERO FOR ERROR.
*
* MAINTENANCE:
*
* 08/08/87 ADD MOD, SIN, COS
* 08/20/87 ADD PI
*
SSP CSECT
ALOG EQU * F0=LOGE(F0)
ENTRY ALOG
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
STD F0,SAVEF0
STD F2,SAVEF2
LA R1,FPLE2 F0=LOGE(2)
SVC FPSVC
LDR F2,F0
LD F0,SAVEF0
LA R1,FPYL2X F0=LOG2(F2*F0)
SVC FPSVC
LD F2,SAVEF2
L R10,SAVE10
BR R14
ALOG10 EQU * F0=LOG10(F0)
ENTRY ALOG10
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
STD F0,SAVEF0
STD F2,SAVEF2
LA R1,FPLT2 F0=LOG10(2)
SVC FPSVC
LDR F2,F0
LD F0,SAVEF0
LA R1,FPYL2X F0=LOG2(F2*F0)
SVC FPSVC
LD F2,SAVEF2
L R10,SAVE10
BR R14
ATAN EQU * F0=ARCTAN(F0)
ENTRY ATAN
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
STD F2,SAVEF2
LDR F2,F0
LE F0,=E'1'
LA R1,FPATAN
SVC FPSVC
LD F2,SAVEF2
L R10,SAVE10
BR R14
COS EQU * F0=COS(F0)
ENTRY COS
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPCOS
SVC FPSVC
L R10,SAVE10
BR R14
EXP EQU * F0=E**(F0)
ENTRY EXP
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
STD F2,SAVEF2
LDR F2,F0
LA R1,FPL2E F0=LOG2(E)
SVC FPSVC
MER F0,F2 F0=LOG2(E)*F0
LA R1,FP2XM1 F0=2**(F0)
SVC FPSVC
LD F2,SAVEF2
L R10,SAVE10
BR R14
INT EQU * R0=F0
ENTRY INT
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPIFIX
SVC FPSVC
L R10,SAVE10
BR R14
MOD EQU * F0=MOD(F0,F2)
ENTRY MOD
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPMOD
SVC FPSVC
L R10,SAVE10
BR R14
PI EQU * F0=PI
ENTRY PI
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPPI
SVC FPSVC
L R10,SAVE10
BR R14
REAL EQU * F0=R0
ENTRY REAL
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPFLOAT
SVC FPSVC
L R10,SAVE10
BR R14
SIN EQU * F0=SIN(F0)
ENTRY SIN
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPSIN
SVC FPSVC
L R10,SAVE10
BR R14
SQRT EQU * F0=SQRT(F0)
ENTRY SQRT
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPSQRT
SVC FPSVC
L R10,SAVE10
BR R14
TAN EQU * F0=TAN(F0)
ENTRY TAN
USING *,R15
ST R10,SAVE10
BALR R10,0
USING *,R10
LA R1,FPTAN
SVC FPSVC
L R10,SAVE10
BR R14
SAVE10 DS F
SAVEF0 DS D
SAVEF2 DS D
R0 EQU 0 INTEGER ARGUMENT/RESULT
R1 EQU 1 SVC ARGUMENT
R10 EQU 10 BASE
R14 EQU 14 RETRUN ADDRESS
R15 EQU 15 ENTRY ADDRESS
F0 EQU 0 FLOATING POINT REGISTER 0
F2 EQU 2 FLOATING POINT REGISTER 2
FPSVC EQU 35 PC/370 FP MICROCODE ROUTINES USING 80X87
FPLT2 EQU 1 F0=LOG10(2)
FPLE2 EQU 2 F0=LOGE(2)
FPL2E EQU 3 F0=LOG2(E)
FPL2T EQU 4 F0=LOG2(10)
FPPI EQU 5 F0=PI
FPATAN EQU 6 F0=ARCTAN(F2/F0)
FPTANXY EQU 7 F2/F0=TAN(F0)
FPSQRT EQU 8 F0=SQRT(F0)
FPYL2X EQU 9 F0=F2*LOG2(F0)
FPYL2XM1 EQU 10 F0=F2*LOG2(F0-1)
FP2XM1 EQU 11 F0=2**(F2*F0)-1
FPFLOAT EQU 12 F0=R0
FPIFIX EQU 13 R0=F0
FPMOD EQU 14 F0=MOD(F0,F2)
FPSIN EQU 15 F0=SIN(F0)
FPCOS EQU 16 F0=COS(F0)
FPTAN EQU 17 F0=TAN(F0)
END